package com.edmond.utils;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class UploadMapping implements WebMvcConfigurer {
    /**
     * 重写文件上传的方法
     *
     * @param registry
     */
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //  设置请求路径和物理路径之间的映射（将/upfile/ 目录映射成为本机物理路径上的目录）
        registry.addResourceHandler("/upfile/**").addResourceLocations("file:F:\\study_space\\springboot_mall\\project_img\\");
    }
}
